<?php
  namespace Home\Controller;
   use Think\Controller;
   class   JiaoController extends Controller {
		public function index(){
		
      $page = isset($_GET['page'])?intval($_GET['page']):1;
      $each_page =30; 
      
      $Data= M('goods');// 实例化Data数据模型
      $total = $Data->count();
      
     $total_page =ceil($total/$each_page);  
     $this->assign('total_page',$total_page); //总页数
       
	   $page = ($page<0)?1:$page;
	   $page = ($page>$total_page)?$total_page:$page;
	  
	   
	   $offset = ($page-1)*$each_page;
     $result= $Data->where('type=3')->order('date desc')->limit($offset ,$each_page)->select();   
     
      $this->assign('total',$total );//留言总数
      $this->assign('page',$page);
     $this->assign('data',$result); 

     $this->display();  
		}
		
		
	
		
}
?>